// ******************************************************************
// * Copyright(c)  Steven Lu
// * Description   : Entity_SALES_WORKING_PLAN
// * CreateDate    : 2011/9/15 23:42:05
// * Creater       : CodeSmith
// * LastChangeDate: 2011/9/15 23:42:05
// * LastChanger   : 2011/9/15 23:42:05
// * Version Info  : 1.0 For ESOL
// ******************************************************************

using System;
using System.Data;
using System.Drawing;
using System.Collections.Generic;
using System.Text;
using Suzsoft.Smart.EntityCore;
using ESOL.Common.Schema;

namespace ESOL.Common.Entity
{
	[Serializable]
	public partial class SalesWorkingPlanEntity : EntityBase
    {
        public SalesWorkingPlanTable TableSchema
        {
            get
            {
                return SalesWorkingPlanTable.Current;
            }
		}
		
		public SalesWorkingPlanEntity()
        {

        }
		
		public SalesWorkingPlanEntity(DataRow dr)
        {
			if(dr == null)
			{
				return;
			}
			this.WorkingPlanId = Convert.ToString(CommonFunctions.ToObject(dr["WORKING_PLAN_ID"]));
			this.PersonId = Convert.ToString(CommonFunctions.ToObject(dr["PERSON_ID"]));
			this.PlanTitle = Convert.ToString(CommonFunctions.ToObject(dr["PLAN_TITLE"]));
			this.PlanDescription = Convert.ToString(CommonFunctions.ToObject(dr["PLAN_DESCRIPTION"]));
			this.StartDate = Convert.ToDateTime(CommonFunctions.ToObject(dr["START_DATE"]));
			this.EndDate = Convert.ToDateTime(CommonFunctions.ToObject(dr["END_DATE"]));
			this.BackColor = Convert.ToString(CommonFunctions.ToObject(dr["BACK_COLOR"]));
        }
		
		public SalesWorkingPlanEntity(DataRowView dr)
        {
			if(dr == null)
			{
				return;
			}
			this.WorkingPlanId = Convert.ToString(CommonFunctions.ToObject(dr["WORKING_PLAN_ID"]));
			this.PersonId = Convert.ToString(CommonFunctions.ToObject(dr["PERSON_ID"]));
			this.PlanTitle = Convert.ToString(CommonFunctions.ToObject(dr["PLAN_TITLE"]));
			this.PlanDescription = Convert.ToString(CommonFunctions.ToObject(dr["PLAN_DESCRIPTION"]));
			this.StartDate = Convert.ToDateTime(CommonFunctions.ToObject(dr["START_DATE"]));
			this.EndDate = Convert.ToDateTime(CommonFunctions.ToObject(dr["END_DATE"]));
			this.BackColor = Convert.ToString(CommonFunctions.ToObject(dr["BACK_COLOR"]));
        }

        public override TableInfo OringTableSchema
        {
            get
            {
                return SalesWorkingPlanTable.Current;
            }
        }
		
		#region Perporty List
        public string WorkingPlanId
        {
            get { return Convert.ToString(GetData(SalesWorkingPlanTable.C_WORKING_PLAN_ID)); }
            set { SetData(SalesWorkingPlanTable.C_WORKING_PLAN_ID, value); }
        }
		
        public string PersonId
        {
            get { return Convert.ToString(GetData(SalesWorkingPlanTable.C_PERSON_ID)); }
            set { SetData(SalesWorkingPlanTable.C_PERSON_ID, value); }
        }
		
        public string PlanTitle
        {
            get { return Convert.ToString(GetData(SalesWorkingPlanTable.C_PLAN_TITLE)); }
            set { SetData(SalesWorkingPlanTable.C_PLAN_TITLE, value); }
        }
		
        public string PlanDescription
        {
            get { return Convert.ToString(GetData(SalesWorkingPlanTable.C_PLAN_DESCRIPTION)); }
            set { SetData(SalesWorkingPlanTable.C_PLAN_DESCRIPTION, value); }
        }
		
        public DateTime StartDate
        {
            get { return Convert.ToDateTime(GetData(SalesWorkingPlanTable.C_START_DATE)); }
            set { SetData(SalesWorkingPlanTable.C_START_DATE, value); }
        }
		
        public DateTime EndDate
        {
            get { return Convert.ToDateTime(GetData(SalesWorkingPlanTable.C_END_DATE)); }
            set { SetData(SalesWorkingPlanTable.C_END_DATE, value); }
        }
		
        public string BackColor
        {
            get { return Convert.ToString(GetData(SalesWorkingPlanTable.C_BACK_COLOR)); }
            set { SetData(SalesWorkingPlanTable.C_BACK_COLOR, value); }
        }
		
		#endregion

        #region Customer Perporty
        public Color BackColorShow
        {
            get
            {
                if (string.IsNullOrEmpty(BackColor) == false && CommonFunctions.IsNumeric(BackColor))
                {
                    //char c = Convert.ToChar(",");
                    //char[] cs = new char[1];
                    //cs[0] = c;
                    //string[] s = BackColor.Split(c);
                    //if (s.Length >= 4)
                    //{
                    //    int a = Convert.ToInt32(s[0]);
                    //    int r = Convert.ToInt32(s[1]);
                    //    int g = Convert.ToInt32(s[2]);
                    //    int b = Convert.ToInt32(s[3]);
                    //    return Color.FromArgb(a, r, g, b);
                    //}
                    //return SystemColors.Control;
                    return Color.FromArgb(CommonFunctions.ToInt32(BackColor));
                }
                return SystemColors.Control;
            }
        }
        #endregion
    }
	
	
}	

